# Create your views here.
# views.py
from django.views.generic import ListView, DetailView
from books.models import Publisher, Book

class PublisherList(ListView):
    model = Publisher
#    context_object_name = 'my_favourite_publishers'

class PublisherDetail(DetailView):
    model = Publisher
#    context_object_name = 'my_favourite_publishers'

    def get_context_data(self, **kwargs):
        # Call the base implementation first to get a context
        context = super(PublisherDetail, self).get_context_data(**kwargs)
        # Add in a QuerySet of all the books
        context['book_list'] = Book.objects.all()
        return context